﻿using System;
using System.Collections.Generic;
using KC.Model.Storage.Base;

namespace KC.Model.Storage.Table
{
    public class ThreadConfigInfo : AzureTableEntity
    {
        public ThreadConfigInfo()
            : base("ThreadConfigInfo", Guid.NewGuid().ToString())
        {
            this.IsEnabled = true;
            this.EnableLiveBackup = false;
            this.EnableEmailService = false;
            this.EnableNotificationService = false;
            this.EnableConversionMonitor = true;
            this.EnableConversionService = true;
            this.EnableUploadProcessing = true;
            this.EnableFullTextSearchIndexer = true;
            this.EnableMetricDatabaseSync = false;
            this.EnableTenantSandboxService = false;
            this.EnableTenantArchiveService = false;
            this.EnableTenantRestoreService = false;
            this.FullTextSearchCheckingIntervalInMinutes = 10;
            this.ConversionTimeoutInMinutes = 30;
            this.MaxRetryTimeForConversion = 3;
            this.ConversionCheckInterval = 1000;
            this.SelectedPdfLibrary = AvailablePdfLibrary[0];
            this.KeepThisConfig = false;
            this.CreateTime = DateTime.UtcNow;
            this.LastModifyTime = DateTime.UtcNow;
        }

        public string WorkerRoleId { get; set; }

        public string HostName { get; set; }

        public bool IsEnabled { get; set; }

        public bool EnableLiveBackup { get; set; }

        public bool EnableEmailService { get; set; }

        public bool EnableNotificationService { get; set; }

        public bool EnableConversionService { get; set; }

        public bool EnableUploadProcessing { get; set; }

        public bool EnableConversionMonitor { get; set; }

        public bool EnableTenantSandboxService { get; set; }

        public bool EnableTenantArchiveService { get; set; }

        public bool EnableTenantRestoreService { get; set; }

        public bool EnableMetricDatabaseSync { get; set; }

        public bool EnableFullTextSearchIndexer { get; set; }

        public int FullTextSearchCheckingIntervalInMinutes { get; set; }

        /// <summary>
        /// timeout include retry 3 times.
        /// </summary>
        public int ConversionTimeoutInMinutes { get; set; }

        public int MaxRetryTimeForConversion { get; set; }

        public int ConversionCheckInterval { get; set; }

        public string SelectedPdfLibrary { get; set; }

        public bool KeepThisConfig { get; set; }

        public DateTime CreateTime { get; set; }

        public DateTime LastModifyTime { get; set; }

        public DateTime LastAccessTime { get; set; }

        public static List<string> AvailablePdfLibrary
        {
            get
            {
                return new List<string>() {
                    "GhostScript",
                    "PDFTron PDF2Image", 
                    "Aspose.Pdf For .Net", 
                    "O2Solutions PDFView4NET",
                    "Tall Component PDFRasterizer.NET"
                };
            }
        }
    }
}
